package com.fs.base.test;

/**
 * @author shuai.fang
 * @date：2017-03-16
 * @description：
 */
public class IdText {

	private Integer id;
	private String name;

	public IdText(Integer id, String name) {
		this.id = id;
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		IdText idText = (IdText) o;

		if (id != null ? !id.equals(idText.id) : idText.id != null) return false;
		return name != null ? name.equals(idText.name) : idText.name == null;

	}

	@Override
	public int hashCode() {
		int result = id != null ? id.hashCode() : 0;
		result = 31 * result + (name != null ? name.hashCode() : 0);
		return result;
	}

	public static void main(String[] args) {
//		Set<IdText> set = Sets.newHashSet();
//		set.add(new IdText(1, "foo"));
//		set.add(new IdText(2, "foot"));
//		set.add(new IdText(3, "foot"));
//		set.add(new IdText(1, "foo"));
//		System.out.println(set.size());

		Integer a = 1131;
		Integer b = 1131;
		System.out.println(a == b);
		System.out.println(a.equals(b));

		Integer c = 3;
		int d = 3;

		System.out.println(c == d);
		System.out.println(new Integer(d).equals(c));
		Integer e = 3;
		System.out.println(c == e);
	}
}
